home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / libnixV1_0.lha / gnu / libnix.install < prev    next >
Text File  |  1995-07-13  |  9KB  |  294 lines

  1. ; $VER: libnix installation script V0.1
  2. ;
  3.  
  4. ; Test if gcc installed
  5.  
  6. (set dir "")
  7. (if (exists "gnu:" (noreq)) (set dir "gnu:"))
  8. (if (exists "gcc:" (noreq)) (set dir "gcc:"))
  9.  
  10. (if (= dir "") (abort "There is no assignment 'gcc:' or 'gnu:'. "
  11.                       "Need a completely installed gcc."))
  12.  
  13. (set @default-dest dir)
  14. (set @app-name "libnix")
  15.  
  16. ; Ask user level
  17.  
  18. (welcome "This is the libnix installation script.") 
  19.  
  20. ; Look for some special programs
  21.  
  22. (if (exists "C:lha" (noreq)) (set lhapath "C:lha") (set lhapath ""))
  23. (procedure setlhapath
  24.   (if (= lhapath "") 
  25.     (set lhapath (askfile (prompt "Couldn't locate your 'lha' program.")
  26.                           (help "No help.")
  27.                           (default "C:lha")
  28.                  )
  29.     )
  30.   )
  31. )
  32.  
  33. (if (exists "C:Search" (noreq)) (set searchpath "C:Search") (set searchpath ""))
  34. (procedure setsearchpath
  35.   (if (= searchpath "") 
  36.     (set searchpath (askfile (prompt "Couldn't locate your 'Search' program.")
  37.                           (help "No help.")
  38.                           (default "C:Search")
  39.                  )
  40.     )
  41.   )
  42. )
  43.  
  44. (if (exists "C:Delete" (noreq)) (set deletepath "C:Delete") (set deletepath ""))
  45. (procedure setdeletepath
  46.   (if (= deletepath "") 
  47.     (set deletepath (askfile (prompt "Couldn't locate your 'Delete' program.")
  48.                              (help "No help.")
  49.                              (default "C:Delete")
  50.                     )
  51.     )
  52.   )
  53. )
  54.  
  55. (if (exists "SYS:Rexxc/RX" (noreq)) (set rxpath "SYS:Rexxc/RX") (set rxpath ""))
  56. (procedure setrxpath
  57.   (if (= rxpath "") 
  58.     (set rxpath (askfile (prompt "Couldn't locate your 'RX' program.")
  59.                          (help "No help.")
  60.                          (default "SYS:Rexxc/RX")
  61.                 )
  62.     )
  63.   )
  64. )
  65.  
  66. ; Check for the right directory
  67.  
  68. (if (<> (expandpath dir) (expandpath (pathonly @icon)))
  69.   ((message "You unpacked libnix into the wrong directory - "
  70.             "I will have to copy files first")
  71.    (copyfiles (source (pathonly @icon)) (dest dir) (infos) (pattern "libnix.guide"))
  72.    (copyfiles (source (pathonly @icon)) (dest dir) (infos) (pattern "libnix.install"))
  73.    (copyfiles (source (pathonly @icon)) (dest dir) (infos) (pattern "libnix.specs.rexx"))
  74.    (copyfiles (source (pathonly @icon)) (dest dir) (infos) (pattern "libnix.specs"))
  75.    (copyfiles (source (pathonly @icon)) (dest dir) (infos) (pattern "lib"))
  76.   )
  77. )
  78.  
  79. (complete 20)
  80.  
  81. ; Look after specs-file
  82.  
  83. (working "Looking for specs-file")
  84. (set dirlist (cat dir "0004"))
  85. (set oldnam "")
  86. (while dirlist
  87.   (; Pop subdirectory
  88.    (set curlen (substr dirlist (- (strlen dirlist) 4))) 
  89.    (set curdir (substr dirlist (- (strlen dirlist) (+ 4 curlen)) (+ curlen 0)))
  90.    (set dirlist (substr dirlist 0 (- (strlen dirlist) (+ 4 curlen))))
  91.  
  92.    (foreach curdir "#?"
  93.      (
  94.       (set curnam (tackon curdir @each-name))
  95.  
  96.       (if (< @each-type 0) ; Test file
  97.         (if (= @each-name "specs")
  98.           (
  99.            (if (NOT oldnam) (set oldnam curnam))
  100.            (if (earlier oldnam curnam) (set oldnam curnam))
  101.           )
  102.         )
  103.       )
  104.  
  105.       (if (> @each-type 0) ; Push subdirectory
  106.         (if (AND (<> @each-name "include") (<> @each-name "os-include"))
  107.           (set dirlist (cat dirlist curnam ("%04ld" (strlen curnam))))
  108.         )
  109.       )
  110.      )
  111.    )
  112.   )
  113. )
  114.  
  115. (if (= @user-level 2)
  116.   (set oldnam 
  117.     (askfile (prompt "Please check the right path for your specs-file.")
  118.              (help "This message appears only in expert mode. "
  119.                    "If you don't know what a specs-file is you "
  120.                    "should choose the default one (which is the "
  121.                    "newest one in the " dir " tree)."
  122.              )
  123.              (default oldnam)
  124.     )
  125.   )
  126. )
  127.  
  128. (if (OR (<> (fileonly oldnam) "specs")
  129.         (NOT (exists oldnam (noreq))))
  130.   (abort "Couldn't find the specs-file. "
  131.          "I refuse to install over an "
  132.          "incomplete installation.")
  133. )
  134.  
  135. ; Process specs-file
  136. ; Check if specs-file already installed
  137.  
  138. (setsearchpath)
  139. (if (OR (exists (cat oldnam ".old"))
  140.         (NOT (run (cat searchpath " " oldnam " noixemul quiet"))))
  141.   (set def 3)
  142.   (set def 1)
  143. )
  144.  
  145. (if (AND (exists (tackon dir "libnix.specs.rexx"))
  146.          (exists (tackon dir "libnix.specs")))
  147.   (select (askchoice
  148.            (prompt "I have to change the specs-file now. Please choose:") 
  149.            (help "To get the '-noixemul' option you will have to "
  150.                  "use a specs-file that takes care of this. "
  151.                  "libnix comes with an ARexx-script that can "
  152.                  "change any specs-file to do the trick. "
  153.                  "If the ARexx-server is not active you can use "
  154.                  "a sample specs-file that comes with libnix."
  155.                  "From gcc2.6.0 on the specsfile is aware of libnix "
  156.                  "and need not be changed."
  157.                  "If you don't know what to do use the sample specs-file.")
  158.            (choices "Change specs-file (needs ARexx)"
  159.                     "Use sample specs-file"
  160.                     "Restore old specs-file"
  161.                     "Skip this part")
  162.            (default def)
  163.           )
  164.     ;the rexx command seems to be broken
  165.     (
  166.      (setrxpath)
  167.      (run (cat rxpath " " (tackon dir "libnix.specs.rexx") " -a " oldnam))
  168.     )
  169.     (
  170.      (if (NOT (exists (cat oldnam ".old")))
  171.        (rename oldnam (cat oldnam ".old"))
  172.      )
  173.      (copyfiles (source (tackon dir "libnix.specs")) (dest "") (newname oldnam))
  174.     )
  175.     (if (exists (cat oldnam ".old"))
  176.       (
  177.        (delete oldnam (infos))
  178.        (rename (cat oldnam ".old") oldnam)
  179.       )
  180.       (
  181.        (setrxpath)
  182.        (run (cat rxpath " " (tackon dir "libnix.specs.rexx") " -r " oldnam))
  183.       )
  184.     )
  185.     (working "skipping...")
  186.   )
  187. )
  188.  
  189. (complete 40)
  190.  
  191. (if (AND (exists (tackon dir "libnix.guide"))
  192.          (exists (tackon dir "lib/libnix/sources.lha")))
  193.   (
  194.    (set c1 (askoptions
  195.             (prompt "libnix comes with (english) documentation. Please choose:")
  196.             (help "No help.")
  197.             (choices "amigaguide format"
  198.                      "texinfo format")
  199.             (default 1)
  200.            )
  201.    )
  202.    (if (BITAND c1 1)
  203.      (
  204.       (copyfiles (source (tackon dir "libnix.guide"))
  205.                  (dest (askdir (prompt "Please choose the destination for "
  206.                                        "the amigaguide document.")
  207.                                (help "No help.")
  208.                                (default (tackon dir "guide"))
  209.                                (newpath)
  210.                        )
  211.                  )
  212.                  (infos)
  213.       )
  214.      )
  215.    )
  216.    (if (BITAND c1 2)
  217.      (
  218.       (working "Unarchiving texinfo document.")
  219.       (setlhapath)
  220.       (run (cat lhapath " x " dir "lib/libnix/sources.lha libnix.texi t:"))
  221.       (copyfiles (source "t:libnix.texi")
  222.                  (dest (askdir (prompt "Please choose the destination for "
  223.                                        "the texinfo document.")
  224.                                (help "No help.")
  225.                                (default (tackon dir "docs"))
  226.                                (newpath)
  227.                        )
  228.                  )
  229.       )
  230.       (delete "t:libnix.texi")
  231.      )
  232.    )
  233.   )
  234. )
  235.  
  236. (complete 60)
  237.  
  238. (if (exists (tackon dir "lib/libnix/sources.lha"))
  239.   (select (askchoice
  240.            (prompt "libnix comes with full sources. Please choose:")
  241.            (help "I hope you know if you need the sources. "
  242.                  "If you don't know delete them!")
  243.            (choices "Unarchive them"
  244.                     "Delete them"
  245.                     "Skip this part")
  246.            (default 1)
  247.           )
  248.  
  249.     (
  250.      (working "Unarchiving source files.")
  251.      (setlhapath)
  252.      (run (cat lhapath " x " dir "lib/libnix/sources.lha " dir "lib/libnix/"))
  253.      (delete (tackon dir "lib/libnix/sources.lha") (infos))
  254.     )
  255.     (
  256.      (setdeletepath)
  257.      (run (cat deletepath " " (tackon dir "lib/libnix/~((#?.a)|(#?.o)|(libb))") " all"))
  258.     )
  259.     (working "skipping...")
  260.   )
  261. )
  262.  
  263. (complete 80)
  264.      
  265. (set c1 (askoptions
  266.          (prompt "Let's clean up now: What would you like deleted?")
  267.          (help "If you don't know what to do just choose the default.")
  268.          (choices "installation stuff"
  269.                   "original documentation file"
  270.                   "libnix libraries and startups")
  271.          (default 3)
  272.         )
  273. )
  274. (if (BITAND c1 1)
  275.   (
  276.    (delete (tackon dir "libnix.install") (infos))
  277.    (delete (tackon dir "libnix.specs.rexx") (infos))
  278.    (delete (tackon dir "libnix.specs") (infos))
  279.   )
  280. )
  281. (if (BITAND c1 2)
  282.   (delete (tackon dir "libnix.guide") (infos))
  283. )
  284. (if (BITAND c1 4)
  285.   (
  286.    (setdeletepath)
  287.    (run (cat deletepath " " (tackon dir "lib/libnix") " all"))
  288.    (run (cat deletepath " " (tackon dir "lib/lib020/libnix") " all"))
  289.   )
  290. )
  291.  
  292. (complete 100)
  293. (exit)
  294.